import java.util.Scanner;

public class GuessNumber {

    public int computer() {
        int com = (int) (Math.random() * 100 + 1);

        return com;
    }
    public String play(int com){
        Scanner sc = new Scanner(System.in);
        int per = sc.nextInt();
        String s;
        if (per == com){
            s = "恭喜您猜对了";
        }else{
            if (per > com ) s="您猜大了";
            else s = "您猜小了";
        }
        return s;
    }
    public static void main(String[] args) {
        GuessNumber gs = new GuessNumber();
        int com = gs.computer();

        for(;;){
        System.out.println("游戏开始，请输入您的猜测结果");
        for (int i =6;i>=0;i--){
            String s =gs.play(com);
            if (s.equals("恭喜您猜对了")){
                System.out.println(s);
                break;
            }
            else{
                System.out.println(s+" 您还剩"+i+"次机会");
            }
        }
        Scanner scc = new Scanner(System.in);
        System.out.println("是否进行下一轮游戏Y/N");
        String Y = scc.next();
        if (Y.equals("N")||Y.equals("n")){
            System.out.println("游戏结束！");
            break;
        }
    }
}
}